<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //剩余参数与arguments差不多
        // const sum = (...args) => {    //args剩余函数是一个数组
        //     let total = 0;
        //     args.forEach(value => total += value);
        //     return total;
        // };
        // console.log(sum(10, 20));
        // console.log(sum(10, 20, 30));


        //剩余参与与解构配合使用
        let arr = ['zhangsan', 'lisi', 'wangwu'];
        let [arr1, ...arr2] = arr;
        console.log(arr1)
        console.log(arr2);;
    </script>
</body>

</html>